home *** CD-ROM | disk | FTP | other *** search
/ Almathera Ten Pack 3: CDPD 3 / Almathera Ten on Ten - Disc 3: CDPD3.iso / scope / 026-050 / scopedisk37 / extract / test.c < prev   
C/C++ Source or Header  |  1995-03-18  |  2KB  |  95 lines

  1. /*
  2.  * Example for using EXTRACTFONT fonts...
  3.  *
  4.  * Compile with
  5.  *    cc +l TEST.c
  6.  *    cc +l SMALL.c
  7.  *
  8.  * Link with
  9.  *    ln TEST.o SMALL.o -lc32
  10.  */
  11.  
  12. #include <exec/types.h>
  13. #include <graphics/gfxbase.h>
  14. #include <intuition/intuition.h>
  15. #include <intuition/intuitionbase.h>
  16. #include <functions.h>
  17. #include <stdio.h>
  18.  
  19. /* Font data */
  20. extern    struct TextFont SmallFont;
  21.  
  22. struct    IntuitionBase    *IntuitionBase = 0;
  23. struct    GfxBase        *GfxBase = 0;
  24.  
  25. struct    Window        *MainWindow = 0;
  26. struct    RastPort    *MainRp = 0;
  27.  
  28. #define MYMODES1    MOUSEBUTTONS
  29. #define ACTIVEMODE    MYMODES1
  30.  
  31. #define WMODES1        ACTIVATE|NOCAREREFRESH
  32. #define WMODES2        RMBTRAP
  33. #define WMODES        WMODES1|WMODES2
  34.  
  35. struct    NewWindow    NewWindow = {
  36.     160, 50,        /* Left, Top Edge        */
  37.     320, 100,        /* Width, Height        */
  38.     0, 1,            /* DetailPen, BlockPen        */
  39.     ACTIVEMODE,        /* IDCMP Flags            */
  40.     WMODES,         /* WINDOWFLAGS            */
  41.     NULL,             /* User Gadgets            */
  42.     NULL,            /* Check Mark            */
  43.     NULL,            /* Title            */
  44.     NULL,            /* Screen            */
  45.     NULL,            /* SuperBitMap            */
  46.     0,0,0,0,        /* Min, Max Size        */
  47.     WBENCHSCREEN        /* Screen Type            */
  48. };
  49.  
  50. Initialize ()
  51. {
  52.     if (( GfxBase = (struct GfxBase *)OpenLibrary ("graphics.library", LIBRARY_VERSION)) == NULL)
  53.         Quit ("Couldn't open graphics.library");
  54.  
  55.     if (( IntuitionBase = (struct IntuitionBase *)OpenLibrary ("intuition.library", LIBRARY_VERSION)) == NULL)
  56.         Quit ("Couldn't open intuition.library");
  57.  
  58.     if (! (MainWindow = OpenWindow (&NewWindow)))
  59.         Quit ("Couldn't open Window");
  60.  
  61.     MainRp = MainWindow->RPort;
  62. }
  63.  
  64. Quit (message)
  65. char    *message;
  66. {
  67.     if (MainWindow)        CloseWindow (MainWindow);
  68.     if (IntuitionBase)    CloseLibrary ((struct Library *)IntuitionBase);
  69.     if (GfxBase)        CloseLibrary (GfxBase);
  70.  
  71.     if (message)
  72.         printf ("Error: %s\n", message);
  73.  
  74.     exit (0);
  75. }
  76.  
  77. main ()
  78. {
  79.     Initialize ();
  80.  
  81.     SetFont (MainRp, &SmallFont);
  82.  
  83.     SetDrMd (MainRp, JAM1);
  84.     SetAPen (MainRp, 1);
  85.  
  86.     Move (MainRp, 10, 10);
  87.     Text (MainRp, "PRESS THE LEFT MOUSE BUTTON!", 28);
  88.  
  89.     WaitPort (MainWindow->UserPort);
  90.  
  91.     Quit (NULL);
  92. }
  93.  
  94.  
  95.